.<template>
  <div>
    <h1>子向父触发自定义事件</h1>
    <hr>
    <ul>
      <li><span>{{id}}</span></li>
      <li><span>{{name}}</span></li>
      <li><span>{{age}}</span></li>
      <button @click="subFn()">减一</button>
    </ul>
  </div>
</template>

<script>
export default {
  props: ['id', 'name', 'age'],
  methods: {
    subFn () {
      this.$emit('sub', this.id, 1);
    }
  },
}
</script>

<style>
</style>